package org.zsl.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.zsl.mapper.UserMapper;
import org.zsl.model.ResponseMessage;
import org.zsl.model.User;


/**
 * service 对应业务实体
 * */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public ResponseMessage login(User user){

        ResponseMessage responseMessage = new ResponseMessage();
        Boolean success= userMapper.exists(user)>0?true:false;
        responseMessage.setSuccess(success);

        return responseMessage;
    }

    /**
     * 动态sql
     * */
    /**
     * 修改密码
     * */
    public ResponseMessage changePassword(User user){

        ResponseMessage responseMessage = new ResponseMessage();
        Boolean success=userMapper.update(user)>0?true:false;

        responseMessage.setSuccess(success);

        return responseMessage;


    }

    /**
     * 修改用户信息
     * */
    public ResponseMessage updateInfo(User user){

        ResponseMessage responseMessage = new ResponseMessage();
        Boolean success=userMapper.update(user)>0?true:false;

        responseMessage.setSuccess(success);

        return responseMessage;


    }
}
